home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / PRIVPU~1.CLS < prev    next >
Text File  |  1997-06-14  |  2KB  |  81 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "CPrivPubFilter"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Option Explicit
  11.  
  12. Implements IFilter
  13.  
  14. Private sSource As String, sTarget As String
  15. Private fAttribute As Boolean, fName As Boolean
  16. Private sName As String
  17.  
  18. ' CPrivPubFilter-specific methods and properties
  19. Public Property Let Name(sNameA As String)
  20.     sName = sNameA
  21. End Property
  22. Public Property Get Name() As String
  23.     Name = sName
  24. End Property
  25.  
  26. ' IFilter implementation
  27. Private Property Let IFilter_Source(sSourceA As String)
  28.     sSource = sSourceA
  29. End Property
  30. Private Property Get IFilter_Source() As String
  31.     IFilter_Source = sSource
  32. End Property
  33.  
  34. Private Property Let IFilter_Target(sTargetA As String)
  35.     sTarget = sTargetA
  36. End Property
  37. Private Property Get IFilter_Target() As String
  38.     IFilter_Target = sTarget
  39. End Property
  40.  
  41. Private Function IFilter_Translate(sLineA As String, ByVal iLineA As Long) As EChunkAction
  42.     ' Translate every line
  43.     IFilter_Translate = ecaTranslate
  44.     If Not fAttribute Then fAttribute = IsExposedFound(sLineA)
  45.     If Not fName Then fName = IsNameFound(sLineA)
  46. End Function
  47.  
  48. Private Function IsExposedFound(sLine As String) As Boolean
  49.     If sLine = sEmpty Then Exit Function
  50.     
  51.     ' Find VB_Exposed attribute and set to True
  52.     Dim sTok As String, sSep As String
  53.     sSep = " " & sTab
  54.     If GetQToken(sLine, sSep) = "Attribute" Then
  55.         If GetQToken(sEmpty, sSep) = "VB_Exposed" Then
  56.             sLine = "Attribute VB_Exposed = True"
  57.             IsExposedFound = True
  58.         End If
  59.     End If
  60. End Function
  61.  
  62. Private Function IsNameFound(sLine As String) As Boolean
  63.     If sLine = sEmpty Then Exit Function
  64.     
  65.     ' Find VB_Name attribute and change it
  66.     Dim sSep As String
  67.     sSep = " " & sTab
  68.     If GetQToken(sLine, sSep) = "Attribute" Then
  69.         If GetQToken(sEmpty, sSep) = "VB_Name" Then
  70.             ' Use default public name if public name isn't already set
  71.             If sName = sEmpty Then
  72.                 ' Skip "="
  73.                 Call GetQToken(sEmpty, sSep)
  74.                 sName = GetQToken(sEmpty, sSep)
  75.             End If
  76.             sLine = "Attribute VB_Name = " & sQuote2 & sName & sQuote2
  77.             IsNameFound = True
  78.         End If
  79.     End If
  80. End Function
  81.